function initialize(prob_st)
% Funcion:   initilize
% Proposito: Inicializa el reloj de la simulacion
%
%
global Q_LIMIT;
global BUSY;
global IDLE;
global INFINITY;

global next_event_type;
global num_custs_delayed;
global num_delays_required;
global num_events;
global num_in_q;
global server_status;

global num_in_system;
global arrivals_mean;
global client_times;
global arrival_times;

%Variables de la UI
global ui_queue_len;
global ui_status;
global ui_mean;

global ui_serving;
%% Variables de tiempos de servicio

%Variables de las ERs
global er_queue_len;
global er_status;
global er_next_event;
global er_next_free;
global er_mean;
global num_er_busy;

%%QUEUE
global er_queue;
global er_queue_index;
global er_queue_last;
global er_queue_max_items;
global er_serving;
%% Variables de tiempos de servicio

%Variables de la ST
global st_queue_len;
global st_status;
global st_mean;
global st_pass;

%%QUEUE
global st_queue;
global st_queue_index;
global st_queue_last;
global st_queue_max_items;
global st_serving;
%% Variables de tiempos de servicio

global time;
global num_arrivals;
global time_next_event;
global total_of_delays;

%Estadisticas
global area_ui_queue;
global area_er_queue;
global area_st_queue;

global area_ui_status;
global area_er1_status;
global area_er2_status;
global area_er3_status;
global area_st_status;

global queue_lengths_vec;

% Inicializa el reloj de la simulacion
time = 0.0;

% Inicializa las variables de estado del modelo
server_status   = IDLE;
num_arrivals    = 0;
num_in_system 	= 0;
time_last_event = 0.0;

% Inicializa los contadores estadisticos
num_custs_delayed  = 0;
total_of_delays    = 0.0;
area_num_in_q      = 0.0;
area_server_status = 0.0;

% Inicializa la lista de eventos
% Como no hay clientes presentes, el evento:partida (servicio completo),
% es eliminado de la consideracion.

arrivals_mean = 1/7.8079;

%Inicializo el random
lecuyer_randseed();

time_next_event(1) = time + (-log(lecuyer_rand()))*arrivals_mean*60;%expon(1/arrivals_mean)*60;
printf("Time first event: %g\n",time_next_event(1));
time_next_event(2) = 1.0e+030;
time_next_event(3) = 1.0e+030;
time_next_event(4) = 1.0e+030;
time_next_event(5) = 1.0e+030;
time_next_event(6) = 1.0e+030;

%arrivals_mean = 7.2991;
%client_times = zeros(1000,4);


ui_queue_len = 0;
ui_status = IDLE;
ui_mean = 8.2202;

ui_serving = 0;

%Variables de las ERs
er_queue_len = 0;
er_status = IDLE;
er_next_event(1) = 1.0e+030;
er_next_event(2) = 1.0e+030;
er_next_event(3) = 1.0e+030;
er_next_free = 0;
num_er_busy = 0;
er_mean = 3;

%Variables de la ST
st_queue_len = 0;
st_status = IDLE;
st_mean = 40;

%Inicializo las colas
er_queue = 0;
er_queue_index = 1;
er_queue_last = 1;
er_queue_max_items = 100000;
er_queue(er_queue_max_items) = 0;
er_serving = 0;
er_serving(1) = 0;
er_serving(2) = 0;
er_serving(3) = 0;
client_times = [0,0,0,0];

st_queue = 0;
st_queue_index = 1;
st_queue_last = 1;
st_queue_max_items = 100000;
st_queue(st_queue_max_items) = 0;
st_serving = 0;

st_pass = prob_st;

area_ui_queue = 0;
area_er_queue = 0;
area_st_queue = 0;

area_ui_status = 0;
area_er1_status = 0;
area_er2_status = 0;
area_er3_status = 0;
area_st_status = 0;

queue_lengths_vec = [0,0,0,0];
arrival_times = [0,0,0,0];
